class HeatingPlan {
    get targetTemperature() {
        if (thermostat.selectedTemperature > this._max) {
            return this._max;
        } else if (thermostat.selectedTemperature < this._min) {
            return this._min;
        } else {
            return thermostat.selectedTemperature;
        }
    }
}

if (thePlan.targetTemperature > thePlan.currentTemperature) {
    setToHeat();
} else if (thePlan.targetTemperature < thePlan.currentTemperature) {
    setToCool();
} else {
    setOff();
}
/************************************************************************ */
class HeatingPlan {
    targetTemperature(selectedTemperature) {
        if (selectedTemperature > this._max) {
            return this._max;
        } else if (selectedTemperature < this._min) {
            return this._min;
        } else {
            return selectedTemperature;
        }
    }
}

if (thePlan.targetTemperature(thermostat.selectedTemperature) > thePlan.currentTemperature) {
    setToHeat();
} else if (thePlan.targetTemperature(thermostat.selectedTemperature) < thePlan.currentTemperature) {
    setToCool();
} else {
    setOff();
}